// TOWN SCRIPT
//    Town 17: Halg

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered.
	enable_add_chars(1);
	set_name(6,"Hasa");
	set_name(7,"Bryn");
	set_name(8,"Fernow");
	set_name(9,"Vodt");
	if (character_in_party(1702) >= 0) 
		erase_char(8);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
break;

beginstate 10;
	if (character_in_party(1702) >= 0) 
		set_state_continue(11);
	set_state_continue(12);
break;

beginstate 11;
	message_dialog("_Well? Where should we be going now?_","");
break;

beginstate 12;
	reset_dialog();
	add_dialog_str(0,"Her eyes glint with excitement. _I can be quite useful, really. And I won't be a pest. How about it?_",0);
	add_dialog_str(1,"Do you accept her offer to travel with you?",0);
	add_dialog_choice(0,"Refuse.");
	add_dialog_choice(1,"Accept.");
	choice = run_dialog(1);
	if (choice == 1)
		end();
	if (choice == 2)
		set_state_continue(13);
break;

beginstate 13;
	message_dialog("She hops up in excitement. _Grand! I won't cause a disturbance, I promise._",
	  "[An NPC has joined you.]");
	add_char_to_party(8);
	set_state_continue(16);
break;

beginstate 14;
	if (get_flag(30,9) >= 1)
		set_state_continue(15);
	set_state_continue(10);
break;

beginstate 15;
	message_dialog("She begins to stand up, then stops and shakes her head.",
	  "_You know, I probably shouldn't go. They'll only say more strange things when I get back._");
break;

beginstate 16;
	set_flag(17,7,1);
break;

beginstate 20;
	if (get_flag(197,3) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"A small shed has been abandoned, by the looks of the dusty condition here, for quite a while. A tiny sign near the door says: _Dowan - Carpenter._",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	set_flag(197,3,250);
break;

